package com.github.codemperor.core.message.omnisend.bean.order;


import com.github.codemperor.core.message.omnisend.OmniSendClient;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * omnisend通讯录
 */
public class ContactsPostRequest {
    private String email;
    private String lastName;
    private String firstName;
    private String status;
    private String statusDate;

    public ContactsPostRequest() {

    }

    public ContactsPostRequest(String email, String firstName, String lastName) {
        this.email = email;
        this.lastName = lastName;
        this.firstName = firstName;
        this.statusDate = OmniSendClient.sdfZone().format(new Date());
        this.status = "subscribed";
    }

    public ContactsPostRequest(String email, String firstName) {
        this.email = email;
        this.firstName = firstName;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
        this.statusDate = sdf.format(new Date());
        this.status = "subscribed";
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getStatusDate() {
        return statusDate;
    }

    public void setStatusDate(String statusDate) {
        this.statusDate = statusDate;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"email\":\"")
                .append(email).append('\"');
        sb.append(",\"lastName\":\"")
                .append(lastName).append('\"');
        sb.append(",\"firstName\":\"")
                .append(firstName).append('\"');
        sb.append(",\"status\":\"")
                .append(status).append('\"');
        sb.append(",\"statusDate\":\"")
                .append(statusDate).append('\"');
        sb.append('}');
        return sb.toString();
    }
}
